/*
环境判断
*/
import router from "../router";

export function processEnv(){
  let baseUrl = '';
  // 环境的切换
  if (process.env.NODE_ENV === 'development') {
    //开发
    baseUrl = 'http://localhost:8080/proxy'; //设置本地代理。跨域请求
  } else if (process.env.NODE_ENV === 'debug') {
    //测试
  } else if (process.env.NODE_ENV === 'production') {
    //线上环境(dict)
    baseUrl = 'https://api.apiopen.top';
  }
  return baseUrl;
}
/*
清除登录
*/
export function clearLoginStatus(){
  sessionStorage.clear();
  router.replace({
    path:'/login'
  })
}
/*
语言切换
*/
export function changeLang(that,type){
  that.$i18n.locale = type;
  localStorage.setItem('lang',type);
  const title = that.$router.history.current.meta.pageTitle || 'indexTitle';
  document.title = that.$t(title);
}
